package com.erlang4j.api;

import com.ericsson.otp.erlang.OtpErlangPid;

/** This is a mail box that you can send data from. */
public interface ISendMailBox {
	/**
	 * Sends the object as a message to the process with the registered server name on the "real" Erlang node.Like all
	 * send methods the variable Self is bound to the value of self()
	 */
	void sendRaw(Object serverNameOrPid, Object object);

	/**
	 * Composes an object and sends it as a message to the process with the registered server name on the "real" Erlang
	 * node. Like all send methods the variable Self is bound to the value of self()
	 * <p>
	 * Example<br>
	 * send("mathServer", "{Self,{add,P0, P1}}", 1,2);
	 */
	void send(Object serverNameOrPid, String pattern, Object... parameters);

	/**
	 * Composes an object of shape {Self,{atom, parameter1, parameter2,etc}} and sends it as a message to the process
	 * with the registered server name on the "real" Erlang node.
	 * <p>
	 * Example<br>
	 * send("mathServer", "{Self,{add,P0, P1}}", 1,2);
	 */
	void sendRpc(Object serverNameOrPid, String atom, Object... parameters);

	/**
	 * Composes an object and sends it as a message to the process with the registered server name on the "real" Erlang
	 * node.Like all send methods the variable Self is bound to the value of self()
	 * <p>
	 * Example<br>
	 * send("mathServer", "{Self,{add,First,Second}}", binding("First",1,"Second", 2);<br>
	 */
	void sendWithBinding(Object serverNameOrPid, String pattern, IBinding binding);

	/**
	 * the pid of the mail box. Note that in the send methods the variable Self is bound to self()
	 */
	OtpErlangPid self();

}
